package com.example.common.enums;

/**
 * 操作类别
 */
public enum OperatorTypeEnum {

    OTHER(0, "其他"),  //其他
    MANAGE(1, "PC用户"),  //pc端
    MOBILE(2, "手机用户");  // 手机

    private String value;
    private int key;

    OperatorTypeEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public void setKey(int key) {
        this.key = key;
    }

    //根据key获取value
    public static String getValue(int key) {
        for (OperatorTypeEnum operatorTypeEnum : values()){
            if (operatorTypeEnum.getKey() == key){
                return operatorTypeEnum.getValue();
            }
        }
        return "";
    }

    //根据value获取key
    public static int getKey(String value) {
        for (OperatorTypeEnum operatorTypeEnum : values()){
            if (operatorTypeEnum.getValue().equals(value)){
                return operatorTypeEnum.getKey();
            }
        }
        return 0;
    }


}


